package com.algorithm;

/**
 * Created by houjinxin on 16/5/6.
 */
public class A {
//    public static void main(String[] args) {
//        A[] a = new A[5];
//
//        A aa= new A();
//        B b = new B();
//        a[0] = b;
//        a[1] = b;
//        a[2] = aa;
//        a[3] = b;
//        a[4] = b;
//        for (A as : a) {
//            System.out.println(as);
//        }
//    }

    public static void main(String[] args) {
        A[] a = new B[5];
        C c = new C();
        a[0] = c;
        for (A as : a) {
            System.out.println(as);
        }
    }
}

class B extends A {

}

class C extends A {
}